/**
 * Notes: 业务基类 
 * Date: 2021-03-15 04:00:00 
 * Ver : CCMiniCloud Framework 2.0.1 ALL RIGHTS RESERVED BY cclinux0730 (wechat)
 */

const MultiModel = require('../../../framework/database/multi_model.js');

class BaseProjectModel extends MultiModel {

	/**
	 * 获取项目名称
	 */
	getProjectId() {
		return 'oa';
	}

	/**
	 * 获取表前缀
	 */
	getTablePrefix() {
		return 'oa_';
	}

	/**
	 * 设置模型名称
	 * @param {String} modelName 模型名称
	 */
	setModel(modelName) {
		this._model = modelName;
		
		// 研发项目相关集合不添加前缀
		if (modelName.startsWith('research_project')) {
			this._name = modelName;
		} else {
			this._name = this.getTablePrefix() + modelName;
		}
	}
}

module.exports = BaseProjectModel;